package com.lh.createData.service.Impl;

import com.lh.createData.dao.ProductMapper;
import com.lh.createData.model.InPutParam.ProductInParam;
import com.lh.createData.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ：梁昊，后端工程师：梁昊
 * @create 2021-07-24 14:19
 * @function
 * @editLog
 */
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    ProductMapper productMapper;

    /**
     * 展示端方法：更新统计次数
     *
     * @param productInParam com.lh.createData.model.InPutParam.ProductInParam
     * @return 影响条数
     */
    @Override
    public int insertProduct (ProductInParam productInParam) {
        if (productMapper.insertProductBeforeCheck(productInParam) == 0)
            return productMapper.insertProduct(productInParam);
        else
            return 0;
    }

    /**
     * 展示端方法：更新统计次数
     *
     * @param productInParam com.lh.createData.model.InPutParam.ProductInParam
     * @return 影响条数
     */
    @Override
    public int insertProductBeforeCheck(ProductInParam productInParam) {
        return productMapper.insertProductBeforeCheck(productInParam);
    }
}
